import request from '../../utils/httpRequest'

const attr = '/product/product/attr'

// 查询list
export function getAttrList (param) {
  return request({
    url: `${attr}/list`,
    method: 'get',
    param
  })
}

// 查询xx属性list
export function getBaseAttrList (params, catId, attrType) {
  return request({
    url: `${attr}/${attrType}/list/${catId}`,
    method: 'get',
    params: params
  })
}

// 根据ids批量删除
export function deleteAttrByIds (data) {
  return request({
    url: `${attr}/delete`,
    method: 'delete',
    data
  })
}

// 根据id查询
export function getAttrById (id) {
  return request({
    url: `${attr}/info/${id}`,
    method: 'get'
  })
}

// 新增
export function saveAttr (data) {
  return request({
    url: `${attr}/save`,
    method: 'post',
    data
  })
}

// 修改
export function updateAttr (data) {
  return request({
    url: `${attr}/update`,
    method: 'put',
    data
  })
}
